//index.js
//获取应用实例
const app = getApp()
const http = app.globalData.http
Page({
  data: {
    Lists:[]
  },
  //事件处理函数
  onLoad: function () {
    let self = this;
    self.ListsFun()
    wx.request({
      url: `${http}/UserLogin`,
      data:{
        Number:123
      },
      success(res){
        wx.setStorage({
          key: 'userId',
          data: res.data
        })
      }
    })
  },
  ListsFun: function () {
    let self = this;
    wx.request({
      url: `${http}/showHome`,
      success(res) {
        // console.log(res.data)
        let result = res.data;
          //赋值
          self.setData({
            Lists: result
          })
        // console.log(self.data.Lists)
      }
    })
  },
  // 点击跳转具体分类
  handelClick(e){
    const type = e.currentTarget.dataset.type
    // console.log(type)
    wx.navigateTo({
      url: `/pages/list/list?type=${type}`,
    })
  }
})
